<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>缴费新增</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <link href="${pageContext.request.contextPath}/static/css/common.css?date=2" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet"/>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<div class="col-sm-12">
    <form class="form-horizontal m-t" id="form" method="post"
          action="${pageContext.request.contextPath}/admin/propertyPay_editDetail.action">
        <input type="hidden" value="${feeDetail.sid}" name="sid" id="sid">
        <div class="form-group">
	        <label class="col-sm-3 control-label"><i class="require">*</i>楼栋:</label>
	        <div class="col-sm-8">
                  <input class="form-control" size="30" value="${feeDetail.cbname}" disabled="disabled"/>
             </div>
	    </div>
         <div class="form-group">
            <label class="col-sm-3  control-label"><i class="require">*</i>单元:</label>
            <div class="col-sm-8">
                <input class="form-control" size="30" value="${feeDetail.unitName}" disabled="disabled"/>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3  control-label"><i class="require">*</i>房间号:</label>
            <div class="col-sm-8">
            	<input class="form-control" size="30" value="${feeDetail.room_no}" disabled="disabled"/>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3  control-label"><i class="require">*</i>业主姓名:</label>
            <div class="col-sm-8">
            <input class="form-control"  size="30" value="${feeDetail.owner_name}" disabled="disabled"/>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3  control-label"><i class="require">*</i>业主手机:</label>
            <div class="col-sm-8">
            <input class="form-control" size="30" value="${feeDetail.owner_tel}" disabled="disabled"/>
            </div>
        </div>
        
        <div id="mTypeDiv" style="display:none">
            <div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>租客姓名:</label>
	            <div class="col-sm-8">
	            <input class="form-control" value="${feeDetail.renter_name}" size="30" disabled="disabled"/>
           		</div>
	        </div>
	         <div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>租客手机:</label>
	            <div class="col-sm-8">
	            <input class="form-control"  value="${feeDetail.renter_tel}"size="30" disabled="disabled"/>
	            </div>
	        </div>
        </div>
        <div class="form-group" id="amountDiv">
            <label class="col-sm-3  control-label"><i class="require">*</i>金额(元):</label>
            <div class="col-sm-8">
                <input class="form-control" name="amount" id="amount" size="30"  onfocus="if(value=='0.00'){value=''}" onkeyup="clearNoNum(this)" onblur="lost(this)"/>
            </div>
        </div>
        <div id="msgDiv">
	        <div class="form-group">
	         <label class="col-sm-3 control-label"><i class="require">*</i>通知用户:</label>
	            <div class="col-sm-8">
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" checked name="msgStatus" size="30" value="0"/><label>不通知</label>
	                </div>
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" name="msgStatus" size="30" value="1"/><label>通知</label>
	                </div>
	            </div>
	        </div>
	        <div class="form-group" id="noticeDiv" style="display:none">
	            <label class="col-sm-3 col-sm-3 control-label">通知内容:</label>
	            <div class="col-sm-8">
	            <div style="margin-top: 5px;margin-bottom: 5px;"><font id="fixedmsg"></font></div>
				<textarea rows="5" cols="80%" name="noticeContent" id="noticeContent">${feeDetail.NOTICE_CONTENT}</textarea>
	            </div>
	        </div>
	        <div class="form-group" id="againTimeDiv">
	            <label class="col-sm-3  control-label" style="float: left;">未缴费提示日期:</label>
	                <div class="col-sm-8">
	                     <input class="form-control" name="againTime" id='againTime'  style="width: 185px;"
	                            onclick='WdatePicker()'/>
	                 </div>
	         </div>
	        
         </div>
         <div id="havePayDiv">
	        <div class="form-group">
	        	 <label class="col-sm-3 control-label"><i class="require">*</i>缴费方式:</label>
	            <div class="col-sm-8">
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" name="payWay" size="30" value="1"/><label>支付宝</label>
	                </div>
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" name="payWay" size="30" value="2"/><label>微信</label>
	                </div>
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" name="payWay" size="30" value="3"/><label>其他</label>
	                </div>
	            </div>
	        </div>
	         <div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>缴费人:</label>
	            <div class="col-sm-8">
	            <input class="form-control" value="${feeDetail.payname}" size="30" disabled="disabled"/>
           		</div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>手机:</label>
	            <div class="col-sm-8">
	            <input class="form-control"  value="${feeDetail.paytel}"size="30" disabled="disabled"/>
	            </div>
	        </div>
	      </div>
	      <div id="noPayDiv">
	      	<div class="form-group" style="margin-left: 11%">已通过其他方式缴费的，可以选择缴费方式，修改为已缴费</div>
	      	<div class="form-group">
	        	 <label class="col-sm-3 control-label">其他缴费方式:</label>
	            <div class="col-sm-8">
	                <!-- <div class="col-sm-2 m-t2" style="width: 150px;">
	                    <input type="radio" name="payType" size="30" value="1"/><label>掌连平台支付</label>
	                </div>
	                <div class="col-sm-2 m-t2">
	                    <input type="radio" name="payType" size="30" value="2"/><label>其他</label>
	                </div> -->
	                    <input type="checkbox" name="payType" size="30" value="2"/><label>业主已经通过现金等其他方式缴费</label>
	            </div>
	        </div>
	      </div>
    </form>
</div>

<script type="text/javascript">
$(function () {
	if('${feeDetail.roomstatus}' == ''){
		$("#mTypeDiv").attr("style","display:none");
	}else{
		if('${feeDetail.roomstatus}' != '2'){
	 	    $("#mTypeDiv").attr("style","display:none");
	    }else{
	    	$("#mTypeDiv").attr("style","");
		}
	}

	if('${feeDetail.againTime}'==''){
		$("#againTime").val(GetDateStr(15));
	}else{
		$("#againTime").val('${feeDetail.againTime}');
	}
	if('${feeDetail.amount}'==''){
		$("#amount").val('0.0');
	}else{
		$("#amount").val(getNum('${feeDetail.amount}'));
	}

	if('${feeDetail.pay_Way}'!=''){
		$("input[name='payWay'][value='${feeDetail.pay_Way}']").attr("checked", true);
	}
	var money = getNum('${feeDetail.amount}');
	$("#fixedmsg").html("尊敬的业主您好：您${feeDetail.communityname}${feeDetail.cbname}${feeDetail.unitName}${feeDetail.room_no}的${feeDetail.item_name} 金额为"+money+"元，请及时缴纳，谢谢!");
	//隐藏内容
	switch ('${feeDetail.status}') {
	case '1':
		$("#msgDiv").attr("style","");
		$("#havePayDiv").attr("style","display:none");
		$("#noPayDiv").attr("style","display:none");
		break;
	case '2':
		$("#msgDiv").attr("style","");
		$("#noPayDiv").attr("style","");
		$("#havePayDiv").attr("style","display:none");
		break;
	case '3':
		$("#msgDiv").attr("style","display:none");
		$("#noPayDiv").attr("style","display:none");
		$("#havePayDiv").attr("style","");
		$("#amount").attr("disabled", "true");
		break;
	default:
		$("#msgDiv").attr("style","");
		$("#havePayDiv").attr("style","display:none");
		$("#noPayDiv").attr("style","display:none");
		break;
	}
	
	 $('input:radio[name="msgStatus"]').change( function(){
     	var selectedvalue = $("input:radio[name='msgStatus']:checked").val();
			if (selectedvalue == 1) {
				$("#noticeDiv").attr("style","");
			} else {
				$("#noticeDiv").attr("style","display:none");
			}
     }); 
});
function GetDateStr(AddDayCount) {
    var dd = new Date();
    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
	var y = dd.getFullYear();
    var m = dd.getMonth()+1;//获取当前月份的日期
    if (m < 9){
        m = "0" + m;
    }
    var d = dd.getDate();
    if (d < 9){
        d = "0" + d;
    }
    return y+"-"+m+"-"+d;
}
function clearNoNum(obj)
{
    //先把非数字的都替换掉，除了数字和.
    obj.value = obj.value.replace(/[^\d.]/g,"");
    //必须保证第一个为数字而不是.
    obj.value = obj.value.replace(/^\./g,"");
    //保证只有出现一个.而没有多个.
    obj.value = obj.value.replace(/\.{2,}/g,".");
    //保证.只出现一次，而不能出现两次以上
}
function lost(obj)
{
	var f = obj.value;  
    if (isNaN(f)) {    
        return false;    
    }    
    obj.value=getNum(f); 
    $("#fixedmsg").html("尊敬的业主您好：您${feeDetail.communityname}${feeDetail.cbname}${feeDetail.unitName}${feeDetail.room_no}的${feeDetail.item_name} 金额为"+getNum(f)+"元，请及时缴纳，谢谢!");
}
function getNum(f){
    
    var f = Math.round(f*100)/100;    
    var s = f.toString();    
    var rs = s.indexOf('.');    
    if (rs < 0) {    
        rs = s.length;    
        s += '.';    
    }    
    while (s.length <= rs + 2) {    
        s += '0';    
    }    
    return s;
}
</script>
</body>
</html>
